#!/bin/sh

FILES=$(find ".hx" . | grep -e ".hx$")

for f in $FILES
do
  echo $f
  sed -i 's/Number\(\.NEGATIVE_INFINITY\)/Math\1/g;s/Number\(\.POSITIVE_INFINITY\)/Math\1/g' $f
  sed -i 's/ Float(\(.*\))/ Std.parseFloat(\1)/g;s/parseInt/Std.parseInt/g' $f
  sed -i 's/isNaN(\(.*\))/Math.isNaN(\1)/g;s/Number.NaN/Math.NaN/g' $f
  sed -i 's/\([a-z0-9]\+\) instanceof \([A-Za-z0-9]\+\)/Std.is(\1,\2)/g' $f
  sed -i "s/\([a-zA-Z0-9.]\+\)\.replace(\(.*)\)/StringTools.replace(\1,\2/g" $f
  sed -i "s/trim(\(.*\))/StringTools.trim(\1)/g" $f
  sed -i 's@break *;\?@/* break */@g' $f
done


